//
//  GYOrderGooodsCell.m
//  GoodLuck
//
//  Created by apple on 2018/3/22.
//  Copyright © 2018年 yunjiazhineng. All rights reserved.
//

static NSString *goodsCellIdentifier = @"goodsCellIdentifier";

#import "GYOrderGooodsCell.h"

@interface GYOrderGooodsCell ()
@property (weak, nonatomic) IBOutlet UIImageView *goodsImageView;
@property (weak, nonatomic) IBOutlet UILabel *goodsNameLable;

@property (weak, nonatomic) IBOutlet UILabel *goodsPriceLable;
@property (weak, nonatomic) IBOutlet UILabel *goodsNumLbale;

@end

@implementation GYOrderGooodsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

+ (instancetype)cellWithTableView:(UITableView *)tableView {
    GYOrderGooodsCell *cell = [tableView dequeueReusableCellWithIdentifier:goodsCellIdentifier];
    
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] firstObject];
    }
    
    return cell;
}

- (void)setGoods:(GYOrderGoods *)goods {
    _goods = goods;
    
    [self.goodsImageView sd_setImageWithURL:[NSURL URLWithString:goods.goods_image_url] placeholderImage:[UIImage imageNamed:@"4"]];
    self.goodsNameLable.text = goods.goods_name;
    self.goodsPriceLable.text = [NSString stringWithFormat:@"¥%@",goods.goods_price];
    self.goodsNumLbale.text = [NSString stringWithFormat:@"x%@",goods.goods_num];
}
@end
